<script>
import dataApi from '@/view/data-api-edit'
import PositionSize from './PositionSize'
import ImgSingle from './ImgSingle'
// import ImgList from './ImgList'
import ViewControlSet from '@/view/ControlItems/ViewControlSet'
import RollTextControlSet from '../ControlItems/RollTextControlSet'
import VideoControlSet from '../ControlItems/VideoControlSet'
import CurrentDateControlSet from '../ControlItems/CurrentDateControlSet'
import WeatherControlSet from '../ControlItems/WeatherControlSet'
import CountdownControlSet from '../ControlItems/CountdownControlSet'
import WebControlSet from '../ControlItems/WebControlSet'
export default {
  render () {
    let setItems = []

    if (dataApi.activeIndex > -1) {
      let { currActiveItem } = dataApi
      setItems.push(<PositionSize />)
      switch (currActiveItem.type) {
        case 1:
          setItems.push(<ImgSingle src={currActiveItem.image} onChange={src => { currActiveItem.image = src }} />)
          break
        case 2:
          setItems.push(<ViewControlSet />)
          break
        case 4:
          setItems.push(<RollTextControlSet />)
          break
        case 5:
          setItems.push(<VideoControlSet />)
          break
        case 6:
          setItems.push(<CurrentDateControlSet />)
          break
        case 7:
          setItems.push(<WeatherControlSet />)
          break
        case 8:
          setItems.push(<CountdownControlSet />)
          break
        case 9:
          setItems.push(<WebControlSet />)
          break
      }
    }

    return (
      <div>{setItems}</div>
    )
  }
}
</script>
